export default {
  data() {
    return {
      carlist: [],
      money: ''
    }
  },
  onLoad(e) {
    // 把数字转换为字符串,再转为金钱格式
    var numArr = e.money
    this.money = e.money
    // var format = JSON.stringify((Number(numArr.match(/-?([1-9]\d*(\.\d*)*|0\.[1-9]\d*)/g))) * 10000)
    // this.money = format.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
    this.GetCarHotList()
  },
  methods: {
    //返回
    returnpage() {
      uni.navigateBack({})
    },
    //验证手机号 是否是新用户
    async yzsjh() {
      try {
        const res = await this.$api.order.yzsjh({
          mobile: this.mobile //电话号码
        })
        if (res.data === 200) {
          this.registernot = true
        }
      } catch (err) {}
    },

    //立即询比价购车接口
    async GetCarHotList() {
      try {
        const res = await this.$api.order.GetCarHotList({})
        if (res.code === 200) {
          this.carlist = res.data
        }

      } catch (err) {}
    },
    carClick(types) {
      //全款/按揭-一成首付以租代售
      if (types.loans) {
        uni.navigateTo({
          url: '/pages_commodity/giantnengjiangDetails/giantnengjiangDetails?goodid=' + types.id
        })
      } else {
        uni.navigateTo({
          url: '/pages_commodity/sourceDetails/sourceDetails?goodid=' + types.id
        })
      }

    },
  }
}
